﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class CMS_SearchList : System.Web.UI.Page
{
    Usas.Common.Cms.CurrentInfo cinfo = new Usas.Common.Cms.CurrentInfo();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            try
            {

                string keyword = Server.UrlDecode(Request["keyword"].ToString());
                string id = Request["typeid"].ToString();
                string mode = Request["mode"].ToString();

                string type = "";
                if (id != "-1")
                {
                    type = " and cmsArticle.TypeId=" + id;
                }
                string kw = "";
                switch (mode)
                {
                    //case "0":
                    //    break;
                    case "1":
                        kw = " and  ArtTopic like '%" + keyword + "%'";
                        break;
                    case "2":
                        kw = " and ArtKeys like '%" + keyword + "%'";
                        break;
                    case "3":
                        kw = " and ArtSummary like '%" + keyword + "%'";
                        break;
                 
                    //case "4":
                    //    break;

                }

                int page = Request["page"] == null ? 1 : Convert.ToInt32(Request["page"]);
                //CV.OnlySearch(CMS_Control_CacheView.ShowMode.Article,20,
                //CV.OnlySearch(CMS_Control_CacheView.ShowMode.Article, 20, "1=1 " + type + kw + " and (IsVersion is null or IsVersion='0') and CmsType.Del='0' and CmsBorder.Del='0' and (CanView is null or CanView='0') and (Audit is null or Audit='0')", cinfo.GetEmpRole(), "搜索列表 <span style='font-size:13px'>关键字：<span style='color:red'>" + keyword + "</span></span> ", page, false,true,-1);
                CV.OnlySearch(CMS_Control_CacheView.ShowMode.Article, 20, "", "搜索列表 <span style='font-size:13px'>关键字：<span style='color:red'>" + keyword + "</span></span> ", cinfo.GetEmpRole(), type + kw, "", page, "", false, false, -1, "");
                MasterPage_MasterPage_CMS mmc = (MasterPage_MasterPage_CMS)this.Page.Master;
                mmc.ManagerHover();
            }
            catch { }
        }
    }
}
